const mixRules = {
  watch: {
    'viewFormData.options': {
      handler(val, oldVal) {
        const {
          column,
          group
        } = val
        let findItem = {}

        column.map(item => {
          if (item.prop === this.option.item.prop) {
            findItem = item
          }
        })
        group.map(g => {
          g.column.map(item => {
            if (item.prop === this.option.item.prop) {
              findItem = item
            }
          })
        })
        if (findItem.rules && findItem.rules.length) {
          findItem.rules.map(rule => {
            if (rule.required) {
              this.required = true
              this.value = findItem.value
            }
          })
        } else {
          this.required = false
        }
      },
      deep: true
    }
  },
  data() {
    return {
      required: false,
    }
  },
  methods: {
  }
}

export default mixRules